///PHILOTES Source Code.  (C)2012 PhiloLabs
#pragma once


#ifndef __StringConverter_H__
#define __StringConverter_H__

#include "OgrePrerequisites.h"
#include "OgreStringVector.h"
#include "util/colourValue.h"
#include "math/mathmisc.h"
#include "math/matrix3.h "
#include "math/matrix4.h "
#include "math/quaternion.h"
#include "math/vector2.h"
#include "math/vector3.h"
#include "math/vector4.h"

namespace Ogre {

	
	
	
    class _OgreExport StringConverter
    {
    public:

        
        static String toString(Real val, unsigned short precision = 6, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
        
        static String toString(Radian val, unsigned short precision = 6, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) )
        {
            return toString(val.valueAngleUnits(), precision, width, fill, flags);
        }
        
        static String toString(Degree val, unsigned short precision = 6, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) )
        {
            return toString(val.valueAngleUnits(), precision, width, fill, flags);
        }
        
        static String toString(int val, unsigned short width = 0, 
            char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
#if OGRE_PLATFORM != OGRE_PLATFORM_NACL &&  ( OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS )
        
        static String toString(unsigned int val, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
        
        static String toString(size_t val, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
        #if OGRE_COMPILER == OGRE_COMPILER_MSVC
                
                static String toString(unsigned long val, 
                    unsigned short width = 0, char fill = ' ', 
                    std::ios::fmtflags flags = std::ios::fmtflags(0) );

        #endif
#else
        
        static String toString(size_t val, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
        
        static String toString(unsigned long val, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
#endif
        
        static String toString(long val, 
            unsigned short width = 0, char fill = ' ', 
            std::ios::fmtflags flags = std::ios::fmtflags(0) );
        
        static String toString(bool val, bool yesNo = false);
		
        static String toString(const Vector2& val);
        
        static String toString(const Vector3& val);
		
        static String toString(const Vector4& val);
        
        static String toString(const Matrix3& val);
        
        static String toString(const Matrix4& val);
        
        static String toString(const Quaternion& val);
        
        static String toString(const ColourValue& val);
        
        static String toString(const StringVector& val);

        
        static Real parseReal(const String& val, Real defaultValue = 0);
        
        static inline Radian parseAngle(const String& val, Radian defaultValue = Radian(0)) {
			return Angle(parseReal(val, defaultValue.valueRadians()));
		}
        
        static int parseInt(const String& val, int defaultValue = 0);
        
        static unsigned int parseUnsignedInt(const String& val, unsigned int defaultValue = 0);
        
        static long parseLong(const String& val, long defaultValue = 0);
        
        static unsigned long parseUnsignedLong(const String& val, unsigned long defaultValue = 0);
        
        static bool parseBool(const String& val, bool defaultValue = 0);
		
		static Vector2 parseVector2(const String& val, const Vector2& defaultValue = Vector2::ZERO);
		
        static Vector3 parseVector3(const String& val, const Vector3& defaultValue = Vector3::ZERO);
        
        static Vector4 parseVector4(const String& val, const Vector4& defaultValue = Vector4::ZERO);
        
        static Matrix3 parseMatrix3(const String& val, const Matrix3& defaultValue = Matrix3::IDENTITY);
        
        static Matrix4 parseMatrix4(const String& val, const Matrix4& defaultValue = Matrix4::IDENTITY);
        
        static Quaternion parseQuaternion(const String& val, const Quaternion& defaultValue = Quaternion::IDENTITY);
        
        static ColourValue parseColourValue(const String& val, const ColourValue& defaultValue = ColourValue::Black);

        
        static StringVector parseStringVector(const String& val);
        
        static bool isNumber(const String& val);
    };

	
	

}



#endif

